#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2023/7/11 22:08
# @Author  : sailor233
# @File    : file_upload.py
# @Software: PyCharm
# @Des     : 文件上传处理
import os
import time

from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
driver.implicitly_wait(5)
driver.get('https://www.baidu.com')
# 点击 相机按钮
driver.find_element(By.CSS_SELECTOR,'.soutu-btn').click()
# 点击 选择文件 按钮
el = driver.find_element(By.CSS_SELECTOR,'.upload-pic')

# 获取文件的绝对路径
jpg_path = os.path.abspath('test.jpg')
# 上传文件
el.send_keys(jpg_path)

time.sleep(10)
